﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using System.Net;
using System.IO;

namespace Chapter26.DnsLookup
{
    /// <summary>
    /// IpWithDnsWindow.xaml 的交互逻辑
    /// </summary>
    public partial class IpWithDnsWindow : Window
    {
        public IpWithDnsWindow()
        {
            InitializeComponent();

            var ipAddress = IPAddress.Parse("234.56.78.9");
            var address = ipAddress.GetAddressBytes();
            var ipString = ipAddress.ToString();
            var loopback = IPAddress.Loopback.ToString();
            var broadcast = IPAddress.Broadcast.ToString();

            var wroxHost = Dns.Resolve("www.wrox.com");
            var wroxHostCopy = Dns.GetHostByAddress("208,215,179,178");

            MessageBox.Show(string.Format("{0},{1},{2},{3},{4},{5},{6}", ipAddress, address, ipString, loopback, broadcast, wroxHost, wroxHostCopy));
        }
    }
}
